<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>

    <script>
        //直接输出num
        //console.log(num);
        //报错

        //先写输出语句后定义
        //console.log(num);
        //var num = 10;
        //输出结果为undefined

        //定义函数调用
        //function fn() {
        //    console.log(123);
        //}
        //fn();
        //无论在前在后都可以调用成功

        //利用函数表达式前后调用
        //fun();
        //var fun = function () {
        //    console.log(123);
        //}
        //先声明后调用正常输出，先调用后声明会报错
    </script>
</head>

<body>

</body>

</html>